'use strict';

const _ = require('lodash');

complaintsController.$inject = ['complaintsService'];

function complaintsController(complaintsService) {
  var vm = this;
  vm.complaintslist = [];

  complaintsService.gets().then(function (res) {
    vm.complaintslist = res.data;
  }).catch(err => console.log(err))

  vm.update = function(status, index){
    let complaints = vm.complaintslist[index];
    complaints.status = status;
    complaintsService.updateStatus(complaints);
  }
}

module.exports = complaintsController;